package com.carworld.controller;

import com.carworld.config.BaseController;
import com.carworld.model.UserReserve;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

public class ReserveController extends BaseController {
	/**
	 * 保存用户的预约订单
	 */
	public void saveReservation() throws UnsupportedEncodingException {
		UserReserve userReserve = new UserReserve();
		userReserve.setUserName(URLDecoder.decode(getPara("userName"),"utf-8"));
		userReserve.setUserMobile(getPara("userMobile"));
		userReserve.setShopId(getPara("shopId"));
		userReserve.setShopName(URLDecoder.decode(getPara("shopName"),"utf-8"));
		userReserve.setReserveTime(getPara("reserveTime").replace("T", " "));
		userReserve.setReserveContent(URLDecoder.decode(getPara("reserveContent"),"utf-8"));
		userReserve.setReserveRemark(URLDecoder.decode(getPara("reserveRemark"),"utf-8"));
		userReserve.setReserveSize(getPara("reserveSize"));
		System.out.println(userReserve.toString());
		String result = UserReserve.dao.saveUserReserve(userReserve,getUserCookie());
		System.out.println("result--" + result);
		renderText(result);

	}

}
